/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;


public class Robot extends MIDlet implements CommandListener 
{
 
  private Display display;
  private Command exitC;
  private Command inicioC, instruC, idiomaC;
  private Canvas  canvas;

    public Robot()
    {   //inicializa la plantalla
        
        display = Display.getDisplay(this);
        canvas = new CanvasForm();
            display.setCurrent(canvas); 
       
        canvas.repaint();     
        comandos();
    }
  
    public void comandos()
    {
        inicioC = new Command("Iniciar",Command.OK,1);
            canvas.addCommand(inicioC);            
        instruC = new Command("Instrucciones",Command.OK,2);
            canvas.addCommand(instruC);
        idiomaC = new Command("Idioma",Command.OK,3);
            canvas.addCommand(idiomaC);            
        
        exitC = new Command("Salir",Command.EXIT,1); 
            canvas.addCommand(exitC);
        
        canvas.setCommandListener(this);        
    }
    
  public void startApp(){}

  public void pauseApp(){}

  public void destroyApp(boolean unconditional){}
  
  public void commandAction(Command c, Displayable d)
  {
        if(c == exitC)
        {//lectura del comando salir
            destroyApp(false);
            notifyDestroyed();
        }  
        
        if(c == inicioC)
        {//
            canvas = new CanvasForm();
                display.setCurrent(canvas); 

            canvas.repaint();  
            comandos();
        }  
                      
  } 
    
}

